/**
 * 
 * 使用装饰器 实现一个get请求
 */

import axios from 'axios'

const GET = (url:string):MethodDecorator => {
    return (target:Object,propertyKey:string | symbol,descriptor:PropertyDescriptor) => {
        const originmethod = descriptor.value;
        axios.get(url).then((res)=>{
            originmethod(res,{status:200})
        }).catch((err)=>{
            originmethod(err,{status:500})
        })
    }
}


class VV{
    @GET('https://api.apiopen.top/api/getHaoKanVideo?page=0&size=10')
    getList(data:any,status:any){
        console.log(data.data.result.list, status)
    }
}

const vv = new VV()
